ActiveReports 12
Rendering to HTML
ActiveReports 12 > ActiveReports User Guide > Concepts > Exporting > Rendering Extensions > Rendering to HTML

HTML, or hypertext markup language, is a format that opens in a Web browser. You can export your reports to HTML or MHT formats. It is a good format for delivering content because virtually all users have an HTML browser. The HTMLRenderingExtension renders your report in this format with improved table border rendering and high quality SVG output for charts. If you do not want to use SVG in charts, set the RenderingEngine property to Html.

The following steps provide an example of rendering a report in the HTML format.

  1. Create a new Visual Studio project.
  2. In the New Project dialog that appears, select ActiveReports 12 Page Report Application and specify a name for the project in the Name field.
  3. Click OK to create a new ActiveReports 12 Page Report Application. By default a Page report is added to the project.
  4. Add reference to GrapeCity.ActiveReports.Export.Html.v12.dll assembly in the project.
  5. On the Form.cs or Form.vb that opens, double-click the title bar to create the Form_Load event.
  6. Add the following code inside the Form_Load event.
    Visual Basic.NET code. Paste INSIDE the Form Load event.
    Copy Code
    ' Provide the page report you want to render.
    Dim report As New GrapeCity.ActiveReports.PageReport()
    Dim reportDocument As New GrapeCity.ActiveReports.Document.PageDocument(report)
    
    ' Create an output directory.
    Dim outputDirectory As New System.IO.DirectoryInfo("C:\MyHTML")
    outputDirectory.Create()
    
    ' Provide settings for your rendering output.
    Dim htmlSetting As New GrapeCity.ActiveReports.Export.Html.Page.Settings()
    Dim setting As GrapeCity.ActiveReports.Extensibility.Rendering.ISettings = htmlSetting
    
    ' Set the rendering extension and render the report.
    Dim htmlRenderingExtension As New GrapeCity.ActiveReports.Export.Html.Page.HtmlRenderingExtension()
    Dim outputProvider As New GrapeCity.ActiveReports.Rendering.IO.FileStreamProvider(outputDirectory, System.IO.Path.GetFileNameWithoutExtension(outputDirectory.Name))
    
    ' Overwrite output file if it already exists.
    outputProvider.OverwriteOutputFile = True
    
    reportDocument.Render(htmlRenderingExtension, outputProvider, htmlSetting)
    
    C# code. Paste INSIDE the Form Load event.
    Copy Code
    // Provide the page report you want to render.
    GrapeCity.ActiveReports.PageReport report = new GrapeCity.ActiveReports.PageReport();
    GrapeCity.ActiveReports.Document.PageDocument reportDocument = new GrapeCity.ActiveReports.Document.PageDocument(report);
    
    // Create an output directory.
    System.IO.DirectoryInfo outputDirectory = new System.IO.DirectoryInfo(@"C:\MyHTML");
    outputDirectory.Create();
    
    // Provide settings for your rendering output.
    GrapeCity.ActiveReports.Export.Html.Page.Settings htmlSetting = new GrapeCity.ActiveReports.Export.Html.Page.Settings();
    GrapeCity.ActiveReports.Extensibility.Rendering.ISettings setting = htmlSetting;
    
    // Set the rendering extension and render the report.
    GrapeCity.ActiveReports.Export.Html.Page.HtmlRenderingExtension htmlRenderingExtension = new GrapeCity.ActiveReports.Export.Html.Page.HtmlRenderingExtension();
    GrapeCity.ActiveReports.Rendering.IO.FileStreamProvider outputProvider = new GrapeCity.ActiveReports.Rendering.IO.FileStreamProvider(outputDirectory, System.IO.Path.GetFileNameWithoutExtension(outputDirectory.Name));
    
    // Overwrite output file if it already exists.
    outputProvider.OverwriteOutputFile = true;
    
    reportDocument.Render(htmlRenderingExtension, outputProvider, htmlSetting);
    

HTML Rendering Properties

ActiveReports offers several options to control how reports render to HTML.

Property Description
Fragment Determine whether or not the full html text will be returned or just the contents contained inside the body tag will be returned. True indicates only the content inside the body tag will be return; otherwise false. The default is false.
MhtOutput Gets or sets whether or not the output should be in Mht format. True indicates the output should be in Mht format; otherwise false. The default is false.
RenderingEngine The RenderingEngine property is set to Mixed by default for improved quality output. The choices are Html or Mixed, where Mixed uses SVG to render charts.
StyleStream Set the StyleStream to True to create an external .css file containing style information from your report controls' style properties. If you prefer to have style information embedded in the HTML file, set the StyleStream property to False.
JavaScript Gets or sets whether or not JavaScript will be included in the html. True indicates JaveScript will be used; otherwise false. The default is true.
LinkTarget Specify a link target to control whether drill down reports and other links open in a new window or reuse the current window. By default, no value is set and links open in the same window. A value of _blank opens the link in a new window, or you can specify a window using window_name. By default this value is not set.
Mode Galley mode renders the report in one HTML stream. Select Paginated mode to render each page as a section inside the HTML document.
OutputTOC Indicates whether the report's existing TOC should be added in the output.

Limitations

Interactivity

Reports rendered in HTML support a number of interactive features. Hyperlinks, Bookmarks and Drill through links can be rendered to HTML. However, Document Maps are not available in this format. For a drill down report, make sure that the data you want to display is expanded before rendering, otherwise it renders in the hidden state.

See Also